﻿using Sw.Hospital.HealthExaminationSystem.Application.Company;
using Sw.Hospital.HealthExaminationSystem.Application.Company.Dto;
using Sw.Hospital.HealthExaminationSystem.Common.Bases;
using Sw.Hospital.HealthExaminationSystem.Common.Helpers;
using Sw.Hospital.HealthExaminationSystem.Common.UserCache;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Sw.Hospital.HealthExaminationSystem.Company
{
    public partial class ClientTeamMoney : UserBaseForm
    {
        private IClientRegAppService clientRegAppService;
        public ClientTeamMoney()
        {
            InitializeComponent();
        }

        private void ClientTeamMoney_Load(object sender, EventArgs e)
        {
            clientRegAppService = new ClientRegAppService();
            searchLookClient.Properties.DataSource = DefinedCacheHelper.GetClientRegNameComDto();
            dateEditStar.EditValue = System.DateTime.Now;
            dateEditEnd.EditValue = System.DateTime.Now;
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            SearchClientDto input = new SearchClientDto();
            if (!string.IsNullOrEmpty(dateEditStar.EditValue?.ToString()))
            {
                input.Star = dateEditStar.DateTime;
            }
            if (!string.IsNullOrEmpty(dateEditEnd.EditValue?.ToString()))
            {
                input.End = dateEditEnd.DateTime;
            }
            if (!string.IsNullOrEmpty(searchLookClient.EditValue?.ToString()))
            {
                input.ClientRegId = (Guid)searchLookClient.EditValue;
            }
          var clientlist=  clientRegAppService.GetClientTeamGroupDtos(input);
            gridControl1.DataSource = clientlist;
        }

        private void simpleButton2_Click(object sender, EventArgs e)
        {

            ExcelHelper.GridViewToExcel(gridView1, "组合报价", "组合报价");
            //var saveFileDialog = new System.Windows.Forms.SaveFileDialog();
            //saveFileDialog.FileName = "组合报价";
            //saveFileDialog.Title = "导出Excel";
            //saveFileDialog.Filter = "Excel文件(*.xls)|*.xls";
            //saveFileDialog.OverwritePrompt = false; //已存在文件是否覆盖提示
            //var dialogResult = saveFileDialog.ShowDialog();
            //if (dialogResult == System.Windows.Forms.DialogResult.Cancel)
            //    return;
            //gridView1.ExportToXls(saveFileDialog.FileName);
        }
    }
}
